<template>
  <div>
     <van-nav-bar fixed>
      <template #left>
        <img class="logo" :src="imgObj"/>
      </template>
      <template #right>
        <van-icon name="search" size="0.48rem" color="#fff"/>
      </template>
</van-nav-bar>
    <van-tabs v-model="channelId"
      animated
      swipeable sticky
      offset-top="1.226667rem">
 <van-tab
 color='#454545'
 v-for="item in channelList"
 :key="item.id"
 :title="item.name"
 :name="item.id"
 >
         <article-list :cid="channelId"></article-list>
    </van-tab>
</van-tabs>
  </div>
</template>

<script>
import logoPng from '../../assets/toutiao_logo.png'
import { userChannelAPI } from '@/api'
import ArticleList from '@/views/Home/ArticleList'
export default {
  data () {
    return {
      channelId: 0,
      imgObj: logoPng,
      channelList: []
    }
  },
  async created () {
    const res = await userChannelAPI()
    this.channelList = res.data.data.channels
    console.log(this.channelList)
  },
  components: {
    ArticleList
  }
}

</script>

<style scoped lang="less">
.logo {
    width: 100px;
    height: 30px;
}
/deep/ .van-tabs__content{
    padding-top: 24px;
}
</style>
